<template>
  <me-navbar class="search-header">
    <i class="iconfont icon-back"
      slot="left"
      @click="backToHome">
    </i>
    <me-search-box
      slot="center"
      @query="query">
    </me-search-box>
  </me-navbar>
</template>
<script>
import meNavbar from '@/base/me-navbar'
import meSearchBox from '@/base/me-search-box'
export default {
  name: 'searcHeader',
  components: {
    meNavbar,
    meSearchBox
  },
  methods: {
    query (value) { // 将搜索词带给父组件
      this.$emit('queryText', value)
    },
    backToHome () { // 回到首页
      this.$router.push({ name: 'home' })
    }
  }
}
</script>
<style lang="stylus" scoped>
.search-header
  width 100%
  padding-right 10px
  background #bebebe
  .iconfont
    font-size 20px
    margin-left -10px
</style>
